<include file="Public/header" />
    <div class="wrapper wrapper-content animated fadeInRight">

            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <!-- <h5>权限分配</h5> -->

                            <!-- <div class="ibox-tools"> -->
                              <!--   <a class="collapse-link" href="{:U('menu/index')}">
                                    <i class="fa fa-chevron-up"></i>生成网站地图
                                </a> -->
                                <!--  <a class="collapse-link" href="{:U('menu/add')}">
                                    <i class="fa fa-plus"></i>添加菜单
                                </a> -->
                 
                            <!-- </div> -->

					<div class="alert alert-success">主要应用于百度站长的百度推广，详细请查看http://zhanzhang.baidu.com</div>
            
                        </div>
                        <div class="ibox-content">

                            <table class="table table-striped table-bordered table-hover dataTables-example dataTable" data-page-size="8">
                                <thead>
                                 <tr>
                                    <td colspan="5">
                                        <ul class="pagination pull-left">
                                        	<div class="btn-group" data-toggle="buttons-checkbox">
						                        <button type="button" class="btn btn-primary add-more btn-outline"  aria-pressed="false"><i class="fa fa-cloud-upload"></i> 推送</button>
						                        <button type="button" class="btn btn-success update-more btn-outline" aria-pressed="false"><i class="fa fa-code-fork"></i> 更新</button>
                                                <button type="button" class="btn btn-danger del-more btn-outline" aria-pressed="false"><i class="fa fa-trash-o"></i> 删除</button>
						                        <a href="/Admin/Tuiguang/sitemap"  class="btn btn-info btn-outline" aria-pressed="false"><i class="fa fa-map-o"></i> 生成网站地图</a>
						                    </div>
                                        </ul>
                                    </td>
                                </tr>
                               <script type="text/javascript">  
                               	    $('.add-more').click(function(event) {
                                        // alert($('.checkbox[checked="checked"]').length)
                                        var nu = $('.checkbox[checked="checked"]').length;
                                        if(nu!=0){
                                            var temp=[];
                                            for (var i = 0; i < nu; i++) {
                                                temp.push($('.checkbox').eq(i).attr('data-url'));
                                            };
                                            var data={"urls":temp}
                                           var url = "/ajax/tuiguang/add";
                                            cmzAjax(url,'json',data);
                                        }else{
                                            cmzAlert('请先选择您要操作的内容',2);
                                        }
                                    });

                                    $('.update-more').click(function(event) {
                                        // alert($('.checkbox[checked="checked"]').length)
                                        var nu = $('.checkbox[checked="checked"]').length;
                                        if(nu!=0){
                                            var temp=[];
                                            for (var i = 0; i < nu; i++) {
                                                temp.push($('.checkbox').eq(i).attr('data-url'));
                                            };
                                            var data={"urls":temp}
                                           var url = "/ajax/tuiguang/update";
                                            cmzAjax(url,'json',data);
                                        }else{
                                            cmzAlert('请先选择您要操作的内容',2);
                                        }
                                    });

                                    $('.del-more').click(function(event) {
                                       if(!confirm('你确定删除吗？')) return false;
                                        var nu = $('.checkbox[checked="checked"]').length;
                                        if(nu!=0){
                                            var temp=[];
                                            for (var i = 0; i < nu; i++) {
                                                temp.push($('.checkbox').eq(i).attr('data-url'));
                                            };
                                            var data={"urls":temp}
                                           var url = "/ajax/tuiguang/del";
                                            cmzAjax(url,'json',data);
                                        }else{
                                            cmzAlert('请先选择您要操作的内容',2);
                                        }
                                    });


                               </script>
                                </thead>
                                <tbody>
                               
                                	<tr>
									<th>
									<a href="javascript:;" class="ico_select_all">全选</a>/
									<a href="javascript:;" class="ico_reverse_select">反选</a>
									</th>
									<th>#</th>
                                    <th>名称</th>
                                    <th>URL</th>
                                    <th>时间</th>
                                    <th>推送次数</th>
                                    <th>更新次数</th>
                                    <th>删除次数</th>
                                    <th>操作</th>
                                   </tr>

 								<?php foreach ($arlist as $k => $v): ?>
                                <tr>
                                <td><i data-url="{$v.url}" style="cursor:pointer;" class="fa fa-square-o ico_checked checkbox"></i></td>
                                <td>{$v.id}</td>
	                             	<td>{$v.title}</td>
	                             	<td> <a href="{$v.url}" target="_blank">{$v.url}</a></td>
	                             	<td>{$v.creattime} </td>
	                             	<td><span  class="btn btn-outline btn-xs btn-default ">{$v.add}</span></td>
	                             	<td><span  class="btn btn-outline btn-xs btn-default ">{$v.update}</span></td>
	                             	<td><span  class="btn btn-outline btn-xs btn-default ">{$v.del}</span></td>
	                             	<td>
	                             		<a type="button" data-url="{$v.url}"  class="btn btn-outline btn-xs btn-primary tui-add">推送数据</a>
	                             		<a type="button" data-url="{$v.url}" class="btn btn-outline btn-xs btn-success tui-update">更新数据</a>
	                             		<a type="button" data-url="{$v.url}" class="btn btn-outline btn-xs btn-danger tui-del">删除数据</a>
	                             	</td>
								</tr>
								  <?php endforeach ?>
                              </tbody>
                            </table>
                            <div></div>
								<script type="text/javascript">
								$('.tui-add').click(function(event) {
									var url = "/ajax/tuiguang/add";
									var data = {"urls[]":$(this).attr('data-url')};
									cmzAjax(url,'json',data);
								});
								$('.tui-update').click(function(event) {
									var url = "/ajax/tuiguang/update";
									var data = {"urls[]":$(this).attr('data-url')};
									cmzAjax(url,'json',data);
								});
								$('.tui-del').click(function(event) {
									if(!confirm('你确定删除吗？')) return false;
									var url = "/ajax/tuiguang/del";
									var data = {"urls[]":$(this).attr('data-url')};
									cmzAjax(url,'json',data);
								});

								</script>
                        </div>
                    </div>
                </div>
            </div>
            
        </div>
